﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntitiesContainer.Entities;

namespace DAL.Context
{
    internal class WebStoreContextInitialization : DropCreateDatabaseAlways<WebStoreContext>
    {
        protected override void Seed(WebStoreContext context)
        {
            context.Users.Add(new User { FirstName = "Денис", LastName = "Лунёв", Email = "denislunev87@gmail.com", Password = "1" });
            context.Users.Add(new User { FirstName = "Валерий", LastName = "Белич", Email = "vbelich@gmail.com", Password = "2" });
            context.Users.Add(new User { FirstName = "Алексей", LastName = "Белецкий", Email = "abeleck@gmail.com", Password = "3" });
            context.Users.Add(new User { FirstName = "Анатолий", LastName = "Пронюк", Email = "apronyk@gmail.com", Password = "4" });
            context.Users.Add(new User { FirstName = "Роман", LastName = "Соколенко", Email = "rsokolen@gmail.com", Password = "5" });
            context.Users.Add(new User { FirstName = "Максим", LastName = "Евсюков", Email = "mevsukov@gmail.com", Password = "6" });
            context.Users.Add(new User { FirstName = "Александр", LastName = "Погорелов", Email = "apogorel@gmail.com", Password = "7" });

            ProductCategory ct1 = new ProductCategory { Name = "Окуневидные" };
            ProductCategory ct2 = new ProductCategory { Name = "Карповидные" };
            ProductCategory ct3 = new ProductCategory { Name = "Пецилиевые" };

            context.ProductCategories.Add(ct1);
            context.ProductCategories.Add(ct2);
            context.ProductCategories.Add(ct3);

            context.Products.Add(new Product { Name = "Гурами", Category = ct1, Price = 12.0m });
            context.Products.Add(new Product { Name = "Дискус", Category = ct1, Price = 20.0m });
            context.Products.Add(new Product { Name = "Скалярия", Category = ct1, Price = 30.0m });
            context.Products.Add(new Product { Name = "Барбус", Category = ct2, Price = 2.0m });
            context.Products.Add(new Product { Name = "Сомик", Category = ct2, Price = 3.0m });
            context.SaveChanges();


        }
    }
}
